import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'laout',
      redirect: '/',
      component: () => import('@/views/layout/index.vue'),
      children: [
        {
          path: '/',
          name: 'index',
          component: () => import('@/views/index/index.vue')
        },
        {
          path: '/user',
          name: 'user',
          component: () => import('@/views/user/index.vue')
        },
        {
          path: '/menu',
          name: 'menu',
          component: () => import('@/views/menu/index.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/login.vue')
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('@/views/login/register.vue')
    },
    {
      path: '/test1',
      name: 'test1',
      component: () => import('@/views/test1/index.vue')
    },
    {
      path: '/test2',
      name: 'test2',
      component: () => import('@/views/test2/index.vue')
    },
    {
      path: '/three',
      name: 'three',
      component: () => import('@/views/three/index.vue')
    },
    {
      path: '/:pathMatch(.*)*',
      name: 'notFound',
      component: () => import('../views/error/404.vue')
    }
  ]
})

export default router
